package jpnms.src.JavaProcess;
/**
 * Thread类
 */
//public class MyThread extends Thread {
//
//    @Override
//    public void run() {
//        super.run();
//        try {
//            sleep(2000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
//        System.out.println("gvsb");
//    }
//}

import java.util.concurrent.Callable;
import java.util.concurrent.Exchanger;

import static java.lang.Thread.sleep;

/**
 * Runnable接口
 */
//public class MyThread implements Runnable {
//
//    @Override
//    public void run() {
//        try {
//            System.out.println(Thread.currentThread().getId() + ":start");
//            sleep(2000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
//        System.out.println("Runnable");
//    }
//}

/**
 *Callable<String>
 */
public class MyThread implements Callable<String> {

    @Override
    public String call() throws InterruptedException {
        System.out.print(Thread.currentThread().getId() + ":start;");

        sleep(2000);
        return Thread.currentThread().getId() + ":success";
    }
}
